<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE>
<html>
  <head>
    <base href="<%=basePath%>">
	<%@include file="/WEB-INF/base/commRoot.jsp"%>
    
    <title>话费充值</title>

	<link href="/css/public.css" type="text/css" rel="stylesheet" />
	<link href="/css/style.css" type="text/css" rel="stylesheet" />
    <link href="/css/account.css" type="text/css" rel="stylesheet" />
	<script type="text/javascript" src="/js/jquery-1.11.1.min.js"></script>
	<script type="text/javascript" src="/js/win_layer/win_layer.js"></script>
	<script type="text/javascript" src="/js/view/user/login.js"></script>
	<script type="text/javascript" src="/js/view/account/sms.js"></script>
	<script type="text/javascript" src="/js/view/account/safe.js"></script>
    <script type="text/javascript" src="/js/jquery.js"></script>
    <script type="text/javascript">
	    $(document).ready(function () {
	        $(".logo_grid").click(function () {
	            $(this).toggleClass("act").find(".desc").toggle();
	        });
	    });
    </script>
    
<!--[if !IE]><!--><script>

if (/*@cc_on!@*/false) {

    document.documentElement.className+=' ie10';

}

</script><!--<![endif]-->
  </head>
  
  <body>
<!--header-->
<jsp:include page="/head.jsp"></jsp:include>
<!--/header-->
	<div class="main_bg">
		<div class="wallet_use clearfix">
			<div class="wallet_use_menu l">
				<dl>
					<dt>钱包应用</dt>
					<dd>
						<a href="javascript:void(0);" class="icon1">转账付款</a>
					</dd>
					<dd>
						<a href="javascript:void(0);" class="icon2">信用卡还款</a>
					</dd>
					<dd class="active">
						<a href="javascript:void(0);" class="icon3">手机充值</a>
					</dd>
				</dl>
			</div>
			
			<s:set value="#request.fundsMap['list']" var="list"></s:set>
			
			<form id="rechargeForm" name="rechargeForm" action="<s:url value="/account/safeAction_telRechargeNext.action"/>" method="post">
			<input name="nominalValue" id="nominalValue" type="hidden">
			<div class="add_credit l">
				<h3></h3>
				<dl class="clearfix">
					<dt class="line36">充值号码：</dt>
					<dd>
						<input type="text" id="mobileNo" name='mobileNo' onblur="checkRechargeMobile();" autocomplete="false" autocomplete="off" onfocus="removeAt();" class="input" /> <p id="temp" class="err_tips l" style="display: none">请输入新手机号</p>
					</dd>
				</dl>
				<dl class="clearfix">
					<dt>面值：</dt>
					<dd>
						<input type="radio" id="credit100" name="credit" class="l" onclick="onChoose(100);" /><label for="credit100" class="l">100元</label>
						<input type="radio" id="credit50" name="credit" class="l" onclick="onChoose(50);"/><label for="credit50" class="l">50元</label>
						<input type="radio" id="creditOther" name="credit" class="l" onclick="onChoose(20);" /><label for="creditOther" class="l">其他</label>
						<dl class="select_input" style="padding-bottom:0;padding-top:0;">
							<dt id="dtId">20</dt>
							<dd>
								<ul>
									<li><a href="javascript:onChoose(20);">20</a></li>
									<li><a href="javascript:onChoose(200);">200</a></li>
									<li><a href="javascript:onChoose(300);">300</a></li>
								</ul>
							</dd>
						</dl>
					</dd>
				</dl>
				<dl class="clearfix">
					<dt>售价：</dt>
					<dd id="ddId" class="altMsg">￥100.00</dd>
					
					<s:iterator var="funds" value="#list" status="i">
					<s:if test="#funds.typeName=='钱包余额'">
					<dd style="color: green; margin-left: 30px">可用余额：￥<s:property value="%{formatMoney(#funds.cash)}" /></dd>
					<input type="hidden" class="cashTmp" value="<s:property value="%{#funds.cash}" />" />
					</s:if>			
					</s:iterator>		
				</dl>
				
				<dl class="clearfix">
					<dt class="line36">支付密码：</dt>
					<input type="password" id="payPwd" name='payPwd' onblur="checkRechargePsw('payPwd');" onfocus="removeAt();" class="input" /> <p id="payPwdTemp" class="err_tips l" style="display: none">请输入支付密码</p>
				</dl>
				
				<a href="javascript:void(0);" class="btn" onclick="onSub()">立即充值</a>  <p id="temp3" name="temp3" class="err_tips l" style="display: none">正在处理...</p>
			</div>
			
			</form>
		</div>
	</div>
	<!--footer-->
<jsp:include page="/footer.jsp"></jsp:include>
</body>

<script type="text/javascript">
	
	var arr1 = <s:property value="rechargeMap.keys"/>;
	var arr2 = <s:property value="rechargeMap.values"/>;


	$(function() {
		$(".select_input").each(
				function() {
					var s = $(this);
					var z = parseInt(s.css("z-index"));
					var dt = $(this).children("dt");
					var dd = $(this).children("dd");
					var _show = function() {
						dd.slideDown(200);
						dt.addClass("cur");
						s.css("z-index", z + 1);
					}; //展开效果
					var _hide = function() {
						dd.slideUp(200);
						dt.removeClass("cur");
						s.css("z-index", z);
					}; //关闭效果
					dt.click(function() {
						dd.is(":hidden") ? _show() : _hide();
					});
					dd.find("a").click(function() {
						dt.html($(this).html());
						_hide();
					}); //选择效果（如需要传值，可自定义参数，在此处返回对应的"value"值 ）
					$("body").click(
							function(i) {
								!$(i.target).parents(".select_input").first()
										.is(s) ? _hide() : "";
							});
				})
	});
	
	
	
	
	function onChoose(money){		
		$(".altMsg").text("");
		for (var i=0;i<arr1.length;i++) {
		  if (arr1[i] == money) {		    
		  	 $(".altMsg").text("￥" + arr2[i]);
		  }
		}
	}
	
   window.onload = function(){   		
   		document.getElementsByName("credit")[0].checked="checked";
   		onChoose(100);
   }
   
   <s:if test="errorMsg != null && errorMsg !='java.lang.Object@1cf8ae' ">
	$("#temp").show();
	$("#temp").text("<s:property value="errorMsg"/>");
	</s:if>
   
</script>
</html>
